#include <chrono>
#include <thread>
#include <condition_variable>
#include <mutex>
#include <iostream>
#include <fstream>
#include <memory>
#include <vector>
#include <map>
#include <sstream>
#include "tensorflow/lite/interpreter.h"
#include "tensorflow/lite/kernels/register.h"
#include "tensorflow/lite/model.h"
#include "tensorflow/lite/optional_debug_tools.h"
#include "tensorflow/lite/delegates/nnapi/nnapi_delegate.h"
#include "tts_lib_intf.h"
//#include "predictor/TtsPredictor.h"
using namespace std;
ofstream *wav_ofs;
    //    std::string out_name(std::to_string(_pcmid)+"debugcpp.pcm");
    //    ofstream wav_ofs(out_name, std::ios::binary|std::ios::out);
    //    wav_ofs.write((char*)_pcm.data(),_pcm.size()*2);
void recv_pcm(std::vector<short> &pcm, void* args,bool endf){
    std::cout<<" recv pcm "<<pcm.size()<<" "<<endf<<std::endl;
    if (pcm.size() > 0){
        wav_ofs->write((char*)pcm.data(),pcm.size()*2);
    }
}
int main(int argc, const char* argv[]) {
      if (argc != 5) {
          std::cerr << "usage: example-app <path-to-exported-script-module>\n";
          return -1;
      }

      //std::string file_name(argv[2]);
      //ifstream ifs(file_name, std::ios::binary|std::ios::in);

      std::string out_name(argv[4]);
      //ofstream wav_ofs(out_name, std::ios::out);
      wav_ofs = new ofstream(out_name, std::ios::binary|std::ios::out);

      std::string model_path(argv[1]);
      std::string model_fix(argv[2]);
      stTTSInst st_tts(model_path,model_fix,recv_pcm,NULL);
      
//      std::vector<std::vector<std::vector<std::string>>> debug_sy = {
//          {{"k_c","tone3","s_begin","word_begin","emotion_neutral","F7"},{"ai_c","tone3","s_end","word_middle","emotion_neutral","F7"},{"m_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"o_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"r_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"uei_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"ga","tone1","s_begin","word_middle","emotion_neutral","F7"},{"an_c","tone1","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"l_c","tone2","s_begin","word_begin","emotion_neutral","F7"},{"ian_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"h_c","tone2","s_begin","word_middle","emotion_neutral","F7"},{"e_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"t_c","tone3","s_begin","word_middle","emotion_neutral","F7"},{"i_c","tone3","s_end","word_middle","emotion_neutral","F7"},{"d_c","tone5","s_begin","word_middle","emotion_neutral","F7"},{"e_c","tone5","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"j_c","tone1","s_begin","word_begin","emotion_neutral","F7"},{"ing_c","tone1","s_end","word_middle","emotion_neutral","F7"},{"j_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"i_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"b_c","tone1","s_begin","word_begin","emotion_neutral","F7"},{"eng_c","tone1","s_end","word_middle","emotion_neutral","F7"},{"k_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"uei_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#3","tone_none","s_none","word_none","emotion_none","F7"},{"p_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"o_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"z_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"ai_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"m_c","tone2","s_begin","word_middle","emotion_neutral","F7"},{"ei_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"j_c","tone2","s_begin","word_middle","emotion_neutral","F7"},{"ie_c","tone2","s_end","word_end","emotion_neutral","F7"},{"#4","tone_none","s_none","word_none","emotion_none","F7"}}
//      };
      std::vector<std::vector<std::vector<std::string>>> debug_sy = {
         // {{"j_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"v_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"w_c","tone1","s_begin","word_begin","emotion_neutral","F7"},{"ei_c","tone1","s_end","word_middle","emotion_neutral","F7"},{"b_c","tone2","s_begin","word_middle","emotion_neutral","F7"},{"o_c","tone2","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"ae","tone1","s_begin","word_begin","emotion_neutral","F7"},{"t","tone1","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"zh_c","tone1","s_begin","word_begin","emotion_neutral","F7"},{"ong_c","tone1","s_end","word_middle","emotion_neutral","F7"},{"g_c","tone2","s_begin","word_middle","emotion_neutral","F7"},{"uo_c","tone2","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"t_c","tone1","s_begin","word_begin","emotion_neutral","F7"},{"ian_c","tone1","s_end","word_middle","emotion_neutral","F7"},{"q_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"i_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"s_c","tone1","s_begin","word_begin","emotion_neutral","F7"},{"an_c","tone1","s_end","word_middle","emotion_neutral","F7"},{"sh_c","tone2","s_begin","word_middle","emotion_neutral","F7"},{"ih_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"y_c","tone1","s_begin","word_middle","emotion_neutral","F7"},{"i_c","tone1","s_end","word_middle","emotion_neutral","F7"},{"r_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"ih_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"b_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"ao_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"d_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"ao_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#3","tone_none","s_none","word_none","emotion_none","F7"},{"b_c","tone3","s_begin","word_begin","emotion_neutral","F7"},{"en_c","tone3","s_end","word_middle","emotion_neutral","F7"},{"l_c","tone2","s_begin","word_middle","emotion_neutral","F7"},{"uen_c","tone2","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"d_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"a_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"f_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"an_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"w_c","tone2","s_begin","word_middle","emotion_neutral","F7"},{"ei_c","tone2","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"y_c","tone2","s_begin","word_begin","emotion_neutral","F7"},{"v_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"xx_c","tone3","s_begin","word_middle","emotion_neutral","F7"},{"ve_c","tone3","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"g_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"uo_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"ch_c","tone2","s_begin","word_middle","emotion_neutral","F7"},{"eng_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"zh_c","tone1","s_begin","word_middle","emotion_neutral","F7"},{"ong_c","tone1","s_end","word_middle","emotion_neutral","F7"},{"d_c","tone5","s_begin","word_middle","emotion_neutral","F7"},{"e_c","tone5","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"h_c","tone2","s_begin","word_begin","emotion_neutral","F7"},{"e_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"xx_c","tone1","s_begin","word_middle","emotion_neutral","F7"},{"in_c","tone1","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"q_c","tone1","s_begin","word_begin","emotion_neutral","F7"},{"v_c","tone1","s_end","word_middle","emotion_neutral","F7"},{"y_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"v_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"h_c","tone2","s_begin","word_begin","emotion_neutral","F7"},{"e_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"n_c","tone2","s_begin","word_middle","emotion_neutral","F7"},{"an_c","tone2","s_end","word_end","emotion_neutral","F7"},{"#4","tone_none","s_none","word_none","emotion_none","F7"}},
      //   {{"xx_c","tone2","s_begin","word_begin","emotion_neutral","F7"},{"ve_c","tone2","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"y_c","tone3","s_begin","word_begin","emotion_neutral","F7"},{"i_c","tone3","s_end","word_middle","emotion_neutral","F7"},{"j_c","tone1","s_begin","word_middle","emotion_neutral","F7"},{"ing_c","tone1","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"xx_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"ia_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"q_c","tone3","s_begin","word_middle","emotion_neutral","F7"},{"i_c","tone3","s_end","word_middle","emotion_neutral","F7"},{"l_c","tone2","s_begin","word_middle","emotion_neutral","F7"},{"ai_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"l_c","tone5","s_begin","word_middle","emotion_neutral","F7"},{"e_c","tone5","s_end","word_end","emotion_neutral","F7"},{"#3","tone_none","s_none","word_none","emotion_none","F7"},{"sh_c","tone3","s_begin","word_begin","emotion_neutral","F7"},{"eng_c","tone3","s_end","word_middle","emotion_neutral","F7"},{"h_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"uei_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"zh_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"eng_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"zh_c","tone1","s_begin","word_middle","emotion_neutral","F7"},{"ou_c","tone1","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"y_c","tone3","s_begin","word_begin","emotion_neutral","F7"},{"e_c","tone3","s_end","word_middle","emotion_neutral","F7"},{"z_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"ai_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"j_c","tone1","s_begin","word_begin","emotion_neutral","F7"},{"in_c","tone1","s_end","word_middle","emotion_neutral","F7"},{"t_c","tone1","s_begin","word_middle","emotion_neutral","F7"},{"ian_c","tone1","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"b_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"ang_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"w_c","tone3","s_begin","word_middle","emotion_neutral","F7"},{"an_c","tone3","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"q_c","tone2","s_begin","word_begin","emotion_neutral","F7"},{"ian_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"h_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"ou_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"k_c","tone1","s_begin","word_begin","emotion_neutral","F7"},{"ai_c","tone1","s_end","word_middle","emotion_neutral","F7"},{"sh_c","tone3","s_begin","word_middle","emotion_neutral","F7"},{"ih_c","tone3","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"ch_c","tone1","s_begin","word_begin","emotion_neutral","F7"},{"u_c","tone1","s_end","word_middle","emotion_neutral","F7"},{"xx_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"ian_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"j_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"iang_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"xx_c","tone3","s_begin","word_middle","emotion_neutral","F7"},{"ve_c","tone3","s_end","word_end","emotion_neutral","F7"},{"#4","tone_none","s_none","word_none","emotion_none","F7"}},
         {{"g_c","tone1","s_begin","word_begin","emotion_neutral","F7"},{"en_c","tone1","s_end","word_middle","emotion_neutral","F7"},{"j_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"v_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"h_c","tone2","s_begin","word_begin","emotion_neutral","F7"},{"e_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"n_c","tone2","s_begin","word_middle","emotion_neutral","F7"},{"an_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"sh_c","tone3","s_begin","word_middle","emotion_neutral","F7"},{"eng_c","tone3","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"q_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"i_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"xx_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"iang_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"t_c","tone2","s_begin","word_middle","emotion_neutral","F7"},{"ai_c","tone2","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"z_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"uei_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"xx_c","tone1","s_begin","word_middle","emotion_neutral","F7"},{"in_c","tone1","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"y_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"v_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"b_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"ao_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#3","tone_none","s_none","word_none","emotion_none","F7"},{"j_c","tone1","s_begin","word_begin","emotion_neutral","F7"},{"in_c","tone1","s_end","word_middle","emotion_neutral","F7"},{"t_c","tone1","s_begin","word_middle","emotion_neutral","F7"},{"ian_c","tone1","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"y_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"e_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"l_c","tone3","s_begin","word_middle","emotion_neutral","F7"},{"i_c","tone3","s_end","word_end","emotion_neutral","F7"},{"#3","tone_none","s_none","word_none","emotion_none","F7"},{"h_c","tone2","s_begin","word_begin","emotion_neutral","F7"},{"uang_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"h_c","tone2","s_begin","word_middle","emotion_neutral","F7"},{"e_c","tone2","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"y_c","tone2","s_begin","word_begin","emotion_neutral","F7"},{"i_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"b_c","tone3","s_begin","word_middle","emotion_neutral","F7"},{"ei_c","tone3","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"h_c","tone2","s_begin","word_begin","emotion_neutral","F7"},{"e_c","tone2","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"s_c","tone1","s_begin","word_begin","emotion_neutral","F7"},{"an_c","tone1","s_end","word_middle","emotion_neutral","F7"},{"m_c","tone2","s_begin","word_middle","emotion_neutral","F7"},{"en_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"xx_c","tone2","s_begin","word_middle","emotion_neutral","F7"},{"ia_c","tone2","s_end","word_end","emotion_neutral","F7"},{"#3","tone_none","s_none","word_none","emotion_none","F7"},{"l_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"uo_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"y_c","tone2","s_begin","word_middle","emotion_neutral","F7"},{"ang_c","tone2","s_end","word_end","emotion_neutral","F7"},{"#3","tone_none","s_none","word_none","emotion_none","F7"},{"p_c","tone2","s_begin","word_begin","emotion_neutral","F7"},{"ing_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"d_c","tone3","s_begin","word_middle","emotion_neutral","F7"},{"ing_c","tone3","s_end","word_middle","emotion_neutral","F7"},{"sh_c","tone1","s_begin","word_middle","emotion_neutral","F7"},{"an_c","tone1","s_end","word_end","emotion_neutral","F7"},{"#3","tone_none","s_none","word_none","emotion_none","F7"},{"zh_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"eng_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"zh_c","tone1","s_begin","word_middle","emotion_neutral","F7"},{"ou_c","tone1","s_end","word_end","emotion_neutral","F7"},{"#3","tone_none","s_none","word_none","emotion_none","F7"},{"xx_c","tone3","s_begin","word_begin","emotion_neutral","F7"},{"v_c","tone3","s_end","word_middle","emotion_neutral","F7"},{"ch_c","tone1","s_begin","word_middle","emotion_neutral","F7"},{"ang_c","tone1","s_end","word_end","emotion_neutral","F7"},{"#4","tone_none","s_none","word_none","emotion_none","F7"}},
        {{"k_c","tone1","s_begin","word_begin","emotion_neutral","F7"},{"ai_c","tone1","s_end","word_middle","emotion_neutral","F7"},{"f_c","tone1","s_begin","word_middle","emotion_neutral","F7"},{"eng_c","tone1","s_end","word_end","emotion_neutral","F7"},{"#3","tone_none","s_none","word_none","emotion_none","F7"},{"sh_c","tone1","s_begin","word_begin","emotion_neutral","F7"},{"ang_c","tone1","s_end","word_middle","emotion_neutral","F7"},{"q_c","tone1","s_begin","word_middle","emotion_neutral","F7"},{"iou_c","tone1","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"b_c","tone3","s_begin","word_begin","emotion_neutral","F7"},{"ei_c","tone3","s_end","word_middle","emotion_neutral","F7"},{"b_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"u_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"y_c","tone3","s_begin","word_begin","emotion_neutral","F7"},{"ou_c","tone3","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"zh_c","tone1","s_begin","word_begin","emotion_neutral","F7"},{"ong_c","tone1","s_end","word_middle","emotion_neutral","F7"},{"d_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"ao_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"d_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"a_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"xx_c","tone3","s_begin","word_middle","emotion_neutral","F7"},{"ve_c","tone3","s_end","word_end","emotion_neutral","F7"},{"#3","tone_none","s_none","word_none","emotion_none","F7"},{"j_c","tone2","s_begin","word_begin","emotion_neutral","F7"},{"v_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"b_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"u_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"b_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"ao_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"xx_c","tone3","s_begin","word_middle","emotion_neutral","F7"},{"ve_c","tone3","s_end","word_end","emotion_neutral","F7"},{"#3","tone_none","s_none","word_none","emotion_none","F7"},{"q_c","tone2","s_begin","word_begin","emotion_neutral","F7"},{"i_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"t_c","tone1","s_begin","word_middle","emotion_neutral","F7"},{"a_c","tone1","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"xx_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"ian_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"sh_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"ih_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"xx_c","tone2","s_begin","word_begin","emotion_neutral","F7"},{"iao_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"y_c","tone2","s_begin","word_middle","emotion_neutral","F7"},{"v_c","tone2","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"zh_c","tone2","s_begin","word_begin","emotion_neutral","F7"},{"uan_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"y_c","tone3","s_begin","word_middle","emotion_neutral","F7"},{"v_c","tone3","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"j_c","tone1","s_begin","word_begin","emotion_neutral","F7"},{"ia_c","tone1","s_end","word_middle","emotion_neutral","F7"},{"xx_c","tone3","s_begin","word_middle","emotion_neutral","F7"},{"ve_c","tone3","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"h_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"uo_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"xx_c","tone3","s_begin","word_begin","emotion_neutral","F7"},{"iao_c","tone3","s_end","word_middle","emotion_neutral","F7"},{"d_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"ao_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"zh_c","tone1","s_begin","word_begin","emotion_neutral","F7"},{"ong_c","tone1","s_end","word_middle","emotion_neutral","F7"},{"xx_c","tone3","s_begin","word_middle","emotion_neutral","F7"},{"ve_c","tone3","s_end","word_end","emotion_neutral","F7"},{"#4","tone_none","s_none","word_none","emotion_none","F7"}},
         {{"b_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"u_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"f_c","tone5","s_begin","word_middle","emotion_neutral","F7"},{"en_c","tone5","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"sh_c","tone2","s_begin","word_begin","emotion_neutral","F7"},{"ih_c","tone2","s_end","word_middle","emotion_neutral","F7"},{"d_c","tone4","s_begin","word_middle","emotion_neutral","F7"},{"uan_c","tone4","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"b_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"an_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"y_c","tone3","s_begin","word_middle","emotion_neutral","F7"},{"ou_c","tone3","s_end","word_end","emotion_neutral","F7"},{"#1","tone_none","s_none","word_none","emotion_none","F7"},{"d_c","tone4","s_begin","word_begin","emotion_neutral","F7"},{"ong_c","tone4","s_end","word_middle","emotion_neutral","F7"},{"y_c","tone3","s_begin","word_middle","emotion_neutral","F7"},{"v_c","tone3","s_end","word_end","emotion_neutral","F7"},{"#4","tone_none","s_none","word_none","emotion_none","F7"}}
      };
	const bool tbUpdateDictFlag = false;

	//FrontAliVc mFrontAliVc;
	//mFrontAliVc.FrontInit("../front/dictionary/", "../front/dict/", "../front/py2phoneMap.txt", tbUpdateDictFlag);

	//const string tcInputText = "北京今天天气怎么样呢，明天偶然呢";
	const string tcInputText(argv[3]);
	const string tcInputLanguage = "zh";

	vector< vector< vector<string> > > tvOutSentenceAliVc;

	//bool tFrontRes = mFrontAliVc.FrontProcess(tcInputText, tcInputLanguage, tvOutSentenceAliVc);
	//cout << tvOutSentenceAliVc << endl;

      std::chrono::time_point<std::chrono::steady_clock> start,end,finish;
      start = std::chrono::steady_clock::now();
      st_tts.input(debug_sy);
      //st_tts.input(tvOutSentenceAliVc);
      finish = std::chrono::steady_clock::now();
      std::cout<< "proctime(ms) : "<<chrono::duration_cast<chrono::milliseconds>(finish-start).count()<<"\n";
      wav_ofs->close();
      std::cout<<"init decoder"<<"\n";
      
      std::cout << "ok\n";
}
